package com.cartel.genius.dto;

import java.io.Serializable;
import java.util.Calendar;

import javax.xml.bind.annotation.XmlRootElement;

/**
 * Data transfer object for Category
 * 
 * @author Naresh Reddy
 */
@XmlRootElement (name = "Category")
public class CategoryTO implements Serializable {

	private static final long serialVersionUID = 1L;
	
	private int categoryId;
	private String categoryName;
	private int parentCategoryId;
	private String parentCategoryName;
	private Calendar createdDate;
	private Calendar modifiedDate;
	private Calendar parentCreatedDate;
	private Calendar parentModifiedDate;
	
	public CategoryTO() {		
	}
	
	public int getCategoryId() {
		return categoryId;
	}
	
	public void setCategoryId(int categoryId) {
		this.categoryId = categoryId;
	}
	
	public String getCategoryName() {
		return categoryName;
	}
	
	public void setCategoryName(String categoryName) {
		this.categoryName = categoryName;
	}
	
	public int getParentCategoryId() {
		return parentCategoryId;
	}
	
	public void setParentCategoryId(int parentCategoryId) {
		this.parentCategoryId = parentCategoryId;
	}
	
	public String getParentCategoryName() {
		return parentCategoryName;
	}
	
	public void setParentCategoryName(String parentCategoryName) {
		this.parentCategoryName = parentCategoryName;
	}
	
	public Calendar getCreatedDate() {
		return createdDate;
	}

	public void setCreatedDate(Calendar createdDate) {
		this.createdDate = createdDate;
	}

	public Calendar getModifiedDate() {
		return modifiedDate;
	}

	public void setModifiedDate(Calendar modifiedDate) {
		this.modifiedDate = modifiedDate;
	}
	
	public Calendar getParentCreatedDate() {
		return parentCreatedDate;
	}

	public void setParentCreatedDate(Calendar parentCreatedDate) {
		this.parentCreatedDate = parentCreatedDate;
	}

	public Calendar getParentModifiedDate() {
		return parentModifiedDate;
	}

	public void setParentModifiedDate(Calendar parentModifiedDate) {
		this.parentModifiedDate = parentModifiedDate;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + categoryId;
		result = prime * result + ((categoryName == null) ? 0 : categoryName.hashCode());
		result = prime * result + parentCategoryId;
		result = prime * result + ((parentCategoryName == null) ? 0 : parentCategoryName.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj) {
			return true;
		}
		if (obj == null) {
			return false;
		}
		if (getClass() != obj.getClass()) {
			return false;
		}
		CategoryTO other = (CategoryTO) obj;
		if (categoryId != other.categoryId) {
			return false;
		}
		if (categoryName == null) {
			if (other.categoryName != null)
				return false;
		} else if (!categoryName.equals(other.categoryName)) {
			return false;
		}
		if (parentCategoryId != other.parentCategoryId) {
			return false;
		}
		if (parentCategoryName == null) { 
			if (other.parentCategoryName != null) {
				return false;
			}
		} else if (!parentCategoryName.equals(other.parentCategoryName)) {
			return false;
		}
		return true;
	}

	@Override
	public String toString() {
		return "CategoryTO [categoryId=" + categoryId + ", categoryName="+ categoryName + ", parentCategoryId=" + parentCategoryId + ", parentCategoryName=" + parentCategoryName + "]";
	}
	
}
